import axios from 'axios'

class WechatModel {
    constructor() {
        this.base = 'http://test.youtoball.com/connect/oauth2/authorize'
        // this.base = 'https://open.weixin.qq.com/connect/oauth2/authorize'
        this.appid = 'wx64d88ac16fbc792f'
    }
    getCode(params) {
        const redirect_uri = encodeURIComponent('http://www.youtoball.com/')
        const end = `${this.base}?appid=${this.appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=123&connect_redirect=1#wechat_redirect`
        // console.log(fetch(end))
        // const ypl = 'http://query.yahooapis.com/v1/public/yql'
        // // console.log(fetchJsonp)
        // fetchJsonp(ypl)
        //
        //
        // const dataType = 'jsonp'
        // const data = {
        //     q:"select * from json where url=\'"+ end +"'",
        //     format:"json"
        // }
        window.location = end

        axios.post(end)
    }

    getToken() {

    }
}

export default WechatModel
